<?php
if (!isset($_COOKIE["login"])){
  header("Location: login.html");
  }
else { ?>
<html>
  <head>
    <title>F &amp; WONDERVIAGGI - Admin Lista Nozze</title>
  </head>
  <body>
    <center>
    <b>LISTA NOZZE</b>
    <fieldset>
      <legend>
        LISTE NOZZE caricate
      </legend>
      <table border=1>
      <tr align="center">
        <td>Sposo</td>
        <td>Sposa</td>
        <td>Viaggio</td>
        <td>Costo</td>
        <td>&nbsp;</td>
      </tr>
<?php
require_once("../connect.php");
$sql_matr_adm = $PDO->query("SELECT * FROM matrimonio_t");
$sql_matr_adm->setFetchMode(PDO::FETCH_ASSOC);
while($row_ma = $sql_matr_adm->fetch()){
  print("<tr align=\"center\"><td>" . $row_ma[sposo] . "</td><td>" . $row_ma[sposa] . "</td><td>" . $row_ma[viaggio] . "</td><td>" . $row_ma[costo] . "</td><td><form id=\"delNews\" method=\"post\" action=\"delmatr.php\"><input value=\"" . $row_ma[id_matr] . "\" type=\"hidden\" name=\"id_matr\"><input type=\"submit\" value=\"ELIMINA\"></form></td></tr>");
}
?>
      </table>
  	</fieldset>
    <br>
    <form id="insNews" method="post" action="insmatr.php">
    	<fieldset>
    		<legend>
    			Inserimento LISTA NOZZE
    		</legend>
    	  <table border=1>
          <tr>
            <td align="center"><b>Sposo</b></td>
            <td><input value="" type="text" name="sposo" maxlength="30" size="30"></td>
          </tr>
          <tr>
            <td align="center"><b>Sposa</b></td>
            <td><input value="" type="text" name="sposa" maxlength="30" size="30"></td>
          </tr>
          <tr>
            <td align="center"><b>Costo</b></td>
            <td><input value="" type="text" name="costo" maxlength="8" size="10"> Inserire solo numeri</td>
          </tr>
          <tr>
            <td align="center"><b>Viaggio</b></td>
            <td><input value="" type="file" name="viaggio" size="50"></td>
          </tr>
          <tr>
            <td align="center" valign="middle" colspan=2>
            <input type="submit" value="Inserisci LISTA NOZZE">
            </td>
          </tr>
        </table>
    	</fieldset>
    </form>
    <br>
    <a href="admin.php">INDIETRO</a>
    </center>
  </body>
</html>
<?php
  }
?>